import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table';
import { rules} from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
//列表数据
export const columns: BasicColumn[] = [
  {
    title: '任务名称',
    align: "center",
    dataIndex: 'taskName'
  },
  {
    title: '任务开始日期',
    align: "center",
    dataIndex: 'taskStartTime',
    customRender:({text}) =>{
      return !text?"":(text.length>10?text.substr(0,10):text);
    },
  },
  {
    title: '任务结束日期',
    align: "center",
    dataIndex: 'taskEndTime',
    customRender:({text}) =>{
      return !text?"":(text.length>10?text.substr(0,10):text);
    },
  },
  {
    title: '任务类型',
    align: "center",
    dataIndex: 'taskTypeName'
  },
  {
    title: '任务描述',
    align: "center",
    dataIndex: 'taskContent'
  },
  {
    title: '检查类型',
    align: "center",
    dataIndex: 'inspectTypeName_dictText'
  },
  {
    title: '完成时间',
    align: "center",
    dataIndex: 'finshTime',
    customRender:({text}) =>{
      return !text?"":(text.length>10?text.substr(0,10):text);
    },
  },
  {
    title: '分解标识',
    align: "center",
    dataIndex: 'salvaged_dictText'
  },
  {
    title: '企业状态',
    align: "center",
    dataIndex: 'enterpriseStatus_dictText'
  },
  {
    title: '是否涉及',
    align: "center",
    dataIndex: 'isInvolves_dictText'
  },
];

//查询数据
export const searchFormSchema: FormSchema[] = [
  {
    label: "任务名称",
    field: 'taskName',
    component: 'Input',
    //colProps: {span: 6},
  },
  {
    label: "任务开始日期",
    field: "taskStartTime",
    component: 'RangePicker',
    //colProps: {span: 6},
  },
  {
    label: "任务结束日期",
    field: "taskEndTime",
    component: 'RangePicker',
    //colProps: {span: 6},
  },
  {
    label: "任务类型",
    field: 'taskTypeName',
    component: 'Input',
    //colProps: {span: 6},
  },
  {
    label: "任务描述",
    field: 'taskContent',
    component: 'Input',
    //colProps: {span: 6},
  },
  {
    label: "企业状态",
    field: 'enterpriseStatus',
    component: 'JDictSelectTag',
    componentProps:{
      dictCode: "enterpriseStatus"
    },
    //colProps: {span: 6},
  },
];

//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '任务名称',
    field: 'taskName',
    component: 'Input',
  },
  {
    label: '任务开始日期',
    field: 'taskStartTime',
    component: 'DatePicker',
  },
  {
    label: '任务结束日期',
    field: 'taskEndTime',
    component: 'DatePicker',
  },
  {
    label: '任务类型',
    field: 'taskTypeName',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入任务类型!'},
             ];
    },
  },
  {
    label: '任务描述',
    field: 'taskContent',
    component: 'InputTextArea',
  },
  {
    label: '检查类型',
    field: 'inspectTypeName',
    component: 'JDictSelectTag',
    componentProps:{
      dictCode: "baseCheckType"
    },
  },
  {
    label: '完成时间',
    field: 'finshTime',
    component: 'DatePicker',
  },
  {
    label: '分解标识',
    field: 'salvaged',
    component: 'JDictSelectTag',
    componentProps:{
      dictCode: "yn"
    },
  },
  {
    label: '企业状态',
    field: 'enterpriseStatus',
    component: 'JDictSelectTag',
    componentProps:{
      dictCode: "enterpriseStatus"
    },
  },
  {
    label: '是否涉及',
    field: 'isInvolves',
    component: 'JDictSelectTag',
    componentProps:{
      dictCode: "isInvolves"
    },
  },
	// TODO 主键隐藏字段，目前写死为ID
  {
    label: '',
    field: 'id',
    component: 'Input',
    show: false,
  },
];

// 高级查询数据
export const superQuerySchema = {
  taskName: {title: '任务名称',order: 0,view: 'text', type: 'string',},
  taskStartTime: {title: '任务开始日期',order: 1,view: 'date', type: 'string',},
  taskEndTime: {title: '任务结束日期',order: 2,view: 'date', type: 'string',},
  taskTypeName: {title: '任务类型',order: 3,view: 'text', type: 'string',},
  taskContent: {title: '任务描述',order: 4,view: 'textarea', type: 'string',},
  inspectTypeName: {title: '检查类型',order: 5,view: 'list', type: 'string',dictCode: 'baseCheckType',},
  finshTime: {title: '完成时间',order: 6,view: 'date', type: 'string',},
  salvaged: {title: '分解标识',order: 7,view: 'radio', type: 'string',},
  enterpriseStatus: {title: '企业状态',order: 8,view: 'radio', type: 'string',},
  isInvolves: {title: '是否涉及',order: 9,view: 'radio', type: 'string',},
};
